package thread;

public class ThreadDemo1 {
    public static void main(String[] args) {
        Thread t1 = new MyThread1();
        Thread t2 = new MyThread2();
        t1.start();
        t2.start();
    }
}
/**
 * 创建多线程的第一种方法
 * 优点：结构简单，利于匿名内部类的创建
 *
 * 缺点：
 * 1.继承冲突问题，Java是单继承的
 */

class MyThread1 extends Thread{
    public void run(){
        for (int i = 0; i < 100; i++){
            System.out.println("线程1：" + i);
        }
    }
}

class MyThread2 extends Thread{
    public void run(){
        for (int i = 0; i < 100; i++){
            System.out.println("线程2：" + i);
        }
    }
}